'------------------------------------------------ 'SPEAK IN FRENCH 'files : STATEMENTFRENCH.BRN (SENTENCELIST) ' dictionaryFRENCH.brn (topicsearch) '------------------------------------------------ If HalBrain.TopicSearch(OriginalSentence, WorkingDir & "dictionaryFRENCH.brn") => "" Then FRENCH = HalBrain.ChooseSentenceFromFile(WorkingDir & "STATEMENTFRENCH.BRN") GetResponse = Spanish & VbCrLf DebugInfo = DebugInfo & "The user is talking FRENCH: " & FRENCH & VbCrLf Else DebugInfo = DebugInfo & "Hal has found nothing FRENCH: " & FRENCH & VbCrLf End If 'Save Process: FRENCH Accelerator version 1.2 If HalBrain.TopicSearch(OriginalSentence, WorkingDir & "dictionaryFRENCH.brn") => "" Then AnswerSent = "" & Trim(OriginalSentence) HalBrain.AppendFile WorkingDir & "dictionaryFRENCH" & ".brn", AnswerSent End If '------------------------------------------------ 'FUNCTION : teach FRENCH translation ' IN FRENCH IS 'Here we can teach Hal FRENCH by saying ' something like: "Yes IN FRENCH IS Oui". '------------------------------------------------ If InStr(OriginalSentence, " ") > 0 And InStr(1, OriginalSentence, " IN FRENCH IS ", 1) > 0 Then SentPieces = Split(OriginalSentence, " IN FRENCH IS ", 2, vbTextCompare) SubPhrase = Trim(SentPieces(0)) PredPhrase = Trim(SentPieces(1)) SubPhrase = HalBrain.AlphaNumericalOnly(SubPhrase) PredPhrase = HalBrain.AlphaNumericalOnly(PredPhrase) 'FRENCH accelerator dictionaryFRENCH.brn, place an apostrophy here on this next line when using corrections as a permanent convertor. HalBrain.AppendFile WorkingDir & "dictionaryFRENCH.brn", """" & SubPhrase & """,""" & PredPhrase & """" 'Convert English to FRENCH permanently by removing the apostrophy on next line. If you back up your 'original Corrections.brn and then delete the existing Corrections.brn and then teach Hal 'a word from English to FRENCH a new Corrections.brn will be made and all words will eventually be converted 'from English to FRENCH permanently once taught all FRENCH words. ' HalBrain.AppendFile WorkingDir & "Corrections.brn", """" & SubPhrase & """,""" & PredPhrase & """" GetResponse = SubPhrase & ", is, " & PredPhrase & " in FRENCH." DebugInfo = DebugInfo & "Spelling is in FRENCH: " & SubPhrase & "to" & PredPhrase & VbCrLf Else DebugInfo = DebugInfo & "Spelling is not in FRENCH: " & SubPhrase & "to" & PredPhrase & VbCrLf End If '------------------------------------------------ '------------------------------------------------ 'FUNCTION : FRENCH translation ' TRANSLATE TO FRENCH 'Here is the translation script, If asked to translate English to FRENCH 'Example is: User: "TRANSLATE Yes TO FRENCH" '------------------------------------------------ If InStr(UserSentence, " TRANSLATE ") > 0 And InStr(1, UserSentence, " TO FRENCH ", 1) > 0 Then Translate = HalBrain.ChooseSentenceFromFile(WorkingDir & "dictionaryFRENCH.brn") & Trim(SubPhrase) & "is" & (Trim(PredPhrase)) GetResponse = Translate & VbCrLf DebugInfo = DebugInfo & "Translating from English to FRENCH: " & GetResponse & VbCrLf Else DebugInfo = DebugInfo & "I'm not Translating from English to FRENCH: " & GetResponse & VbCrLf End If 'OBTAIN RESPONSE FROM FRENCH qaDATABASE (CREATED FROM SCRATCH BY FRENCH BRAIN): If HalBrain.FragmentMatch(UserSentence, WorkingDir & "QAFRENCH.brn") => "" Then GetResponse = HalBrain.FragmentMatch(UserSentence, WorkingDir & "QAFRENCH.brn")& VbCrLf DebugInfo = DebugInfo & "USER IS SPEAKING FRENCH: " & GetResponse & VbCrLf HalBrain.AppendFile WorkingDir & "QAFRENCH.brn", "@" & UserSentence & VbCrLf & " " & UCase(PrevSent) ELSE DebugInfo = DebugInfo & "USER IS NOT SPEAKING FRENCH: " & GetResponse & VbCrLf END IF